$(()=>{
    let $get = $("#get");
    let $inputbox = $("#inputbox");
    $inputbox.focus();
    let $main = $("#main");
    let $table = $("#table");
    /*let $item1 = $("#item1");*/
    let $item2 = $("#item2");
    let $item3 = $("#item3");
    let $item4 = $("#item4");
    $inputbox.keydown(e=>{if (e.keyCode===13)$get.click();});
    $(document).keydown(e=>{if(e.keyCode===36){if (e.ctrlKey){if(confirm("是否要返回上一页？")){location.href = "./?/index";}}else{if(confirm("是否要返回首页？")){history.back();}}}else if(e.keyCode===45){$inputbox.focus();}});
    $get.click(()=>{
        $main.addClass("el-loading");
        let qq = $inputbox.val();
        $.post("#",{
            qq:qq
        },text=>{
            $main.removeClass("el-loading");
            $table.hide();
            $table.removeClass("el-loading");
            if (text.indexOf("JSON数据：")!==-1){
                text=text.replace("JSON数据：","");
                let data=JSON.parse(text);
                /*$item1.text(qq);*/
                $item2.text(data[0]["nickname"]);
                $item3.html(`<img src="${data[0]["touxiang"]}" width="150">`);
                $item4.text(data[0]["email"]);
                $table.fadeIn();
                console.log(data);
            }else {
                alert(text);
            }

            // console.log(text);
        });
    });
});
